#include "PIterator.h"

PIterator::PIterator( Predicate * p )
{
	root_p = p;
	curr_idx = 0;
	m_predicate_vec.clear();

	AddChild( p );
}
PIterator::~PIterator()
{

}
Predicate* PIterator::value() 
{
	return m_predicate_vec[curr_idx];
};
bool PIterator::end()
{
	return curr_idx == m_predicate_vec.size();
};
void PIterator::reset()
{
	curr_idx = 0;
};
void PIterator::AddChild( Predicate* p )
{
	m_predicate_vec.push_back( p );
	for( std::multimap<std::string, Predicate*>::iterator childIt = p->child.begin(); 
		childIt != p->child.end(); childIt ++ )
	{
		AddChild( (*childIt).second );
	}
}